package com.hongyue.dey01;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class Demo {
    public static void main(String[] args) {
        HashMap<String, String> hm = new HashMap<>();
        hm.put("贾乃亮", "李小璐");
        hm.put("王宝强", "荣荣");
        hm.put("羽凡", "白百合");
        Set<String> keys = hm.keySet();
        Iterator<String> iterator = keys.iterator();
        while (iterator.hasNext()) {
            String key = iterator.next();
            String s = hm.get(key);
            System.out.println("丈夫：" + key + "\t 妻子：" + s);
        }
        for (String key : keys) {
            String s = hm.get(key);
            System.out.println("丈夫：" + key + "\t 妻子：" + s);
        }
    }
}
